import { Component } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';

import { NzResultStatusType } from 'ng-zorro-antd/result';

const INFO: { [key: string]: string } = {
  '403': '你没有此页面的访问权限',
  '404': '此页面未找到',
  '500': '服务器发生了错误'
};

@Component({
  selector: 'app-base-exception',
  templateUrl: './exception.component.html',
  styleUrls: ['./exception.component.less'],
})
export class BaseExceptionComponent {
  constructor(
    protected router: Router,
    private activatedRoute: ActivatedRoute
  ) {}

  get type(): NzResultStatusType {
    return this.activatedRoute.snapshot.data['type'];
  }

  get info(): string {
    return INFO[this.type];
  }
}
